<?php
//获取通知的数据
$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
if(!xml)
{
	die("xml格式异常");
}
//将xml转换为数组
$arr = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
file_put_contents("a.txt", serialize($arr));
//检测签名(暂时省略)

////支付成功
//if($arr['result_code'] ==="SUCCESS")
//{
//	$order_no=$arr['out_trade_no'];//获取订单号
//	//payment_id=2表明该支付方式为微信支付
//	$url="http://qcjn99.com/ss.php?con=payment&act=index&order_no={$order_no}&payment_id=2";
//	echo "<SCRIPT LANGUAGE=\"javascript\">location.href='$url'</SCRIPT>";
//	//header("Location:{$url}");
//	echo 'success';
//}
//else 
//{
//	echo 'fail';
//}
//a:16:{s:5:"appid";s:18:"wx7ea367b003ea9667";s:9:"bank_type";s:9:"ABC_DEBIT";s:8:"cash_fee";s:1:"1";s:8:"fee_type";s:3:"CNY";s:12:"is_subscribe";s:1:"N";s:6:"mch_id";s:10:"1264106101";s:9:"nonce_str";s:32:"2a7872fbddf185df0b728ed23af8fd6c";s:6:"openid";s:28:"o52kuwfix3mjYQslgSWj_rwf5c5g";s:12:"out_trade_no";s:20:"20150817211512421837";s:11:"result_code";s:7:"SUCCESS";s:11:"return_code";s:7:"SUCCESS";s:4:"sign";s:32:"48521620DE2329DCAFEFFF1910D2C9D6";s:8:"time_end";s:14:"20150817211522";s:9:"total_fee";s:1:"1";s:10:"trade_type";s:3:"APP";s:14:"transaction_id";s:28:"1006660377201508170643770042";}
$str=urlencode(serialize($arr));
//$url="http://qcjn99.com/ss.php?con=payment&act=index&str={$str}&payment_id=8";
$url="http://test.hbwksc.com/index.php?con=Paymchongzhi&act=index&str={$str}&payment_id=2";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);  
$data = curl_exec($curl);
echo $data;
//header("Location:{$url}");
?>